/*
 * @Description: 行按钮配置
 * @Author: HuiSir<https://gitee.com/huisir001>
 * @Date: 2025-07-28 21:55:31
 * @LastEditTime: 2025-09-15 18:04:42
 */
import { defineRowBtnsOptions } from "@/components/TablePage/predefined";
import useEditOptions from "./useEditOptions";
import { saveDept, delDept } from "@/api/sys";

export default defineRowBtnsOptions(() => ({
  editRequest: saveDept,
  addRequest: saveDept,
  delRequest: delDept,
  editDialogProps: { title: "编辑部门" },
  addDialogProps: { title: "新增部门" },
  editFormOptions: useEditOptions(),
  addFormOptions: useEditOptions(),
  beforeShowAddDialog(rowData) {
    // 新增时设置当前行为父节点
    rowData.value = {
      pid: rowData.value.id,
    };
  },
}));
